/**
 * 
 */
package ro.dta.idbi.model;

import java.util.ArrayList;
import java.util.List;

import ro.dta.idbi.interfaces.ITransformationResult;
import uk.ac.ic.doc.automed.reps.Schema;

/**
 * Transformation pattern result class
 * 
 * @author Tudor Dobrila
 * 
 */
public class TransformationResult implements ITransformationResult {

	/**
	 * Original schema
	 */
	private Schema originalSchema;

	/**
	 * Transformed schema
	 */
	private Schema transSchema;

	/**
	 * Transformation macro (command)
	 */
	private List<String> transCmd;

	/**
	 * Transformation result class constructor
	 * 
	 * @param originalSchema
	 *            Original schema
	 * @param transSchema
	 *            Schema after the transformation has been applied over the
	 *            original schema
	 * @param transCmd
	 *            Transformation command used to transform the original schema
	 *            into the transformed schema
	 */
	public TransformationResult(final Schema originalSchema, final Schema transSchema,
			final String transCmd) {
		this.originalSchema = originalSchema;
		this.transSchema = transSchema;
		this.transCmd = new ArrayList<String>();
		this.transCmd.add(transCmd);
	}

	/**
	 * Transformation result class constructor
	 * 
	 * @param originalSchema
	 *            Original schema
	 * @param transSchema
	 *            Schema after the transformation has been applied over the
	 *            original schema
	 * @param transCmd
	 *            Transformation command used to transform the original schema
	 *            into the transformed schema
	 */
	public TransformationResult(final Schema originalSchema, final Schema transSchema,
			final String[] transCmd) {
		this.originalSchema = originalSchema;
		this.transSchema = transSchema;
		this.transCmd = new ArrayList<String>();
		for (String t : transCmd) {
			this.transCmd.add(t);
		}
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * ro.dta.idbi.model.ITransformationResult#setOriginalSchema(java.lang.String
	 * )
	 */
	@Override
	public void setOriginalSchema(final Schema originalSchema) {
		this.originalSchema = originalSchema;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ro.dta.idbi.model.ITransformationResult#getOriginalSchema()
	 */
	@Override
	public Schema getOriginalSchema() {
		return originalSchema;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * ro.dta.idbi.model.ITransformationResult#setTransSchema(java.lang.String)
	 */
	@Override
	public void setTransSchema(final Schema transSchema) {
		this.transSchema = transSchema;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ro.dta.idbi.model.ITransformationResult#getTransSchema()
	 */
	@Override
	public Schema getTransSchema() {
		return transSchema;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * ro.dta.idbi.model.ITransformationResult#setTransCmd(java.lang.String)
	 */
	@Override
	public void setTransCmd(final List<String> transCmd) {
		this.transCmd = transCmd;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ro.dta.idbi.model.ITransformationResult#getTransCmd()
	 */
	@Override
	public List<String> getTransCmd() {
		return transCmd;
	}

}
